package com.platform.exception;

public enum SysError implements IErrorCode {

    /**
     * 交易成功
     */
    SUCCESS(0, "OK"),
	/**
     * 未知错误
     */
    UNKNOWN(1, "System service is not available now, please try again later"),
    /**
     * 服务器维护中
     */
    MAINTENANCE(2, "The server has been maintained"),
    /**
     * 参数错误
     */
    PARAMETER_ERR(3, "Parameter error, please check the required parameter"),
    /**
     * 系统忙
     */
    BUSY(4, "System is busy"),
    /**
     * TOKEN失效
     */
    TOKEN_INVALIDATE(5, "Token invalidate"),
    /**
     * 无操作权限
     */
    NO_PERMISSION(6, "No permission"),
    /**
     * 无相关配置
     */
    NO_CONFIG(7, "No config"),
    /**
     * 系统日期异常
     */
    SYSTEM_DATE_EMPTY(8, "System date empty"),
    /**
     * 返回体为空
     */
    RESPONSE_BODY_EMPTY(9, "Response body empty"),
    /**
     * 反序列化失败
     */
    RESERIALIZER_ERROR(10, "Reserializer error"),
    /**
     * 系统不支持该交易类型
     */
    UNSUPPORTED_TRANSACTION_TYPE(11, "Unsupported transaction type"),
    /**
     * 发送短信失败
     */
    SMS_MASSAGE_ERROR(12, "Send sms error"),
//    /**
//     * 系统错误
//     */
//    SYSTEM_ERROR(13, "System error, {0}"),

    ENUM_ERROR(14, "ENUM error"),

    REDIS_GET_LOCK_EXCEPTION(15, "Redis get lock exception"),

    EVENT_MSG_EMPTY(16, "event msg empty"),

    EVENT_MSGID_EMPTY(17, "event msgid empty"),

    Duplicate_REQUEST(18, "duplicate request"),

    /**
     * 参数校验不通过
     */
    PARAM_MISSING(19, "param check failed：{0}"),

    /**
     * 请求大数据接口异常
     */
    CALL_BIGDATA_FAIL(20, "Call bigdata fail"),

    /**
     * 请求字段有误,字段名称{0}
     */
    REQUEST_FIELD_ERROR(21, "check field error, name{0}, reason:{1}"),

    /**
     * 请求接口方法不正确
     */
    REQUEST_METHOD_NOT_SUPPORTED(22, "request method not supported"),


    MEDIA_TYPE_NOT_SUPPORTED(23, "Media type not supported"),

    /**
     * 404 NOT Found
     */
    REQUEST_404(24, "request 404 not found"),

    /**
     * 调用{0}接口异常,异常原因:{1}
     * */
    CALL_API_FAIL(9996, "call api:{0} failed, reason:{1}"),

    /**
     * 调报文格式异常
     * */
    INTERFACE_CONTENT_ERROR(9998, "interface content error"),

    /**
     * 系统异常
     */
    SYS_ERROR(9999, "sys error：{0}"),
    ;

    SysError(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    /**
     * 系统编号16
     *
     * @return
     */
    @Override
    public Integer getSys() {
        return null;
    }

    /**
     * 模块编号01
     *
     * @return
     */
    @Override
    public Integer getModule() {
        return null;
    }

    @Override
    public Integer getCode() {
        return this.code;
    }

    @Override
    public String getMsg() {
        return msg;
    }

    /**
     * 返回string类型code
     * @return
     */
    public String getCodeStr() {
        return String.valueOf(this.code);
    }

    private Integer code;
    private String msg;
}
